//
//  MEOptionViewController.swift
//  aj
//
//  Created by leeqb on 15/12/16.
//  Copyright © 2015年 powerlee. All rights reserved.
//

import UIKit

class MEOptionViewController: AJBaseViewController {

    @IBOutlet weak var textView: UITextView!
    @IBOutlet weak var optionTap: UIImageView!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationItem.title = "意见反馈"
        optionTap.userInteractionEnabled = true
        let handTap = UITapGestureRecognizer(target: self, action: "Handler:")
        optionTap.addGestureRecognizer(handTap)
        // Do any additional setup after loading the view.
    }

    func Handler(sender:UITapGestureRecognizer){
        let params = [ "userId": DataManager.userInfo()!["userId"] as! String,"content":  textView.text,"type": "1"]
        CBMessage.shareInstance().showProcessing()
        AJNetworkHelper.instance.post("aj_feedback", parameters: params, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) -> Void in
            // 请求成功
            if (responseObject["returnCode"] as? String == "000000"){
                CBAlertView.shareInstance().showMsg("意见反馈成功")
            } else {
                CBAlertView.shareInstance().showMsg(responseObject["errorMsg"] as? String)
            }
            }, failed: { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in
                CBAlertView.shareInstance().showMsg("意见反馈失败")
            }) { () -> Void in
                CBMessage.shareInstance().dismiss()
        }

    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
